import request from '@/utils/request'

const prePath = "/supplier";

//获取销售单列表
export function getSaleOrderPage(params) {
    return request({
        url: prePath + '/saleOrder/page',
        method: 'get',
        params
    })
}

//获取销售单列表
export function getPendDeliverOrderPage(params) {
  return request({
    url: prePath + '/saleOrder/getPendDeliverOrderPage',
    method: 'get',
    params
  })
}

export function getSaleOrderDetailPage(params) {
    return request({
        url: prePath + '/saleOrderDetail/page',
        method: 'get',
        params
    })
}

//模糊查询销售单
export function likeFind(params) {
    return request({
        url: prePath + '/saleOrder/likeFind',
        method: 'get',
        params
    })
}
//查看详情
export function getSaleOrderById(id) {
    return request({
        url: prePath + '/saleOrder/' + id,
        method: 'get'
    })
}
//新增数据
export function addSaleOrder(data) {
    return request({
        url: prePath + '/saleOrder',
        method: 'post',
        data
    })
}
//修改手工录入销售单
export function updateSaleOrder(data) {
    return request({
        url: prePath + '/saleOrder',
        method: 'put',
        data
    })
}
//删除销售单
export function deleteSaleOrder(data) {
    return request({
        url: prePath + '/saleOrder',
        method: 'delete',
        data
    })
}

//接收整单（主表上的按钮）
export function acceptSaleAll(id) {
    return request({
        url: prePath + '/saleOrder/accept/'+id,
        method: 'put'
    })
}
//拒收整单（主表上的按钮）
export function refuseSaleAll(id) {
    return request({
        url: prePath + '/saleOrder/refuse/'+id,
        method: 'put'
    })
}

//详情接收（详情界面上的按钮）
export function acceptSaleDetail(data) {
    return request({
        url: prePath + '/saleOrderDetail/acceptSaleDetail',
        method: 'put',
        data
    })
}
//详情拒收（详情界面上的按钮）
export function refuseSaleDetail(data) {
    return request({
        url: prePath + '/saleOrderDetail/refuseSaleDetail/',
        method: 'put',
        data
    })
}

//详情
export function saleDetailBySaleId(params) {
    return request({
        url: prePath + '/saleOrderDetail/all',
        method: 'get',
        params
    })
}

//删除销售单
export function deleteSale(id) {
    return request({
        url: prePath + '/saleOrder/deleteHandwork/'+id,
        method: 'delete'
    })
}
//导出销售单
export function exportExcelSaleOrder(id) {
    return request({
        url: prePath + `/saleOrder/${id}/excel`,
        method: 'get',
        responseType: 'blob'
    })
}
//打印销售单
export function printSaleOrder(id) {
    return request({
        url: prePath + `/saleOrder/${id}/print`,
        method: 'get'
    })
}

//获取发货单列表
export function getDeliverOrder(params) {
    return request({
        url: prePath + '/deliverOrder/page',
        method: 'get',
        params
    })
}

//查询发货单的详情(！！！！！！！！！！发货单修改页面专用)
export function findDetail4Update(id) {
    return request({
        url: prePath + '/deliverOrder/deliverOrderDetail4Update/'+id,
        method: 'get'
    })
}

//发货单新增数据
export function addDeliverOrder(data) {
    return request({
        url: prePath + '/deliverOrder',
        method: 'post',
        data
    })
}
//发货单新增数据
export function updateDeliverOrder(data) {
    return request({
        url: prePath + '/deliverOrder',
        method: 'put',
        data
    })
}
//销售单点击生成发货单时，界面渲染需要的数据
export function showCreatDeliverView(saleId) {
    return request({
        url: prePath + '/deliverOrder/showCreatDeliverView/'+saleId,
        method: 'get'
    })
}

//导出发货单excel
export function exportExcelDeliverOrder(id) {
    return request({
        url: prePath + `/deliverOrder/${id}/excel`,
        method: 'get',
        responseType: 'blob'
    })
}
//打印发货单
export function printDeliverOrder(id) {
    return request({
        url: prePath + `/deliverOrder/${id}/print`,
        method: 'get'
    })
}
//整单打印二维码
export function printQrCodeDeliverOrder(data) {
    return request({
        url: prePath + `/deliverOrder/printQrCode`,
        method: 'post',
        data
    })
}
//整单生成二维码
export function generateCodeDeliverOrder(data) {
  return request({
    url: prePath + `/deliverOrder/generateCode`,
    method: 'post',
    data
  })
}
//整单打印二维码
export function printQrCodeDeliverOrderDetails(data) {
    return request({
        url: prePath + `/deliverOrderDetail/printQrCodeVO`,
        method: 'post',
        data
    })
}
//打印二产品码
export function deliverOrderProductCodePrint(data) {
    return request({
        url: prePath + `/deliverOrder/productCode/print`,
        method: 'post',
        data
    })
}

//删除发货单，整单删除
export function deleteDeliverOrder(data) {
    return request({
        url: prePath + '/deliverOrder',
        method: 'delete',
        data
    })
}

//取消发货单，整单取消
export function cancelDeliverOrder(data) {
    return request({
        url: prePath + '/deliverOrder/cancelDeliver',
        method: 'post',
        data
    })
}
//发货
export function shipmentsGoods(data) {
    return request({
        url: prePath + '/deliverOrder/shipmentsGoods',
        method: 'post',
        data
    })
}
//重新发货
export function againShipmentsDeliverOrder(data) {
    return request({
        url: prePath + '/deliverOrder/againShipmentsGoods',
        method: 'post',
		data
    })
}


//打印二维码
export function printQrCode(data) {
    return request({
        url: prePath + '/deliverOrder/printQrCode',
        method: 'post',
        data
    })
}
// 打印发货单
export function sprintDeliver(params) {
    return request({
        url: prePath + `/deliverOrder/${params}/print`,
        method: 'get',
    })
}
// 医院对应供应商
export function getSupplier() {
    return request({
        url: prePath + `/deliverOrder/findSupplierByHospital`,
        method: 'get',
    })
}
// 发货单列表
export function getDeliverList(params) {
    return request({
        url: prePath + `/deliverOrder/likeFindInUseReceiveOrder`,
        method: 'get',
        params
    })
}
// 发货单列表详情
export function getDeliverDetail(params) {
    return request({
        url: prePath + `/deliverOrder/showReceiveViewByDeliver/${params}`,
        method: 'get',
    })
}
// 个体码详情
export function getUniqueDetails(params) {
    return request({
        url: prePath + `/deliverOrder/showReceiveViewByDeliver`,
        method: 'get',
        params
    })
}
//获取销售单产品
export function getSaleOrderProduct(params) {
    return request({
        url: prePath + `/deliverOrder/saleDetailForDelivery`,
        method: 'get',
        params
    })
}
//重新发货获取弹窗数据
export function getDeliverOrderDetail(params) {
    return request({
        url: prePath + `/deliverOrderDetail/page`,
        method: 'get',
        params
    })
}
//重新发货扣减发货单详情的待发货数量
export function putDeliverOrderDetail(data) {
    return request({
        url: prePath + `/deliverOrderDetail/pendReceiveQtyReduce`,
        method: 'put',
        data
    })
}
//发货单根据id查询一条数据
export function getDeliverOrderById(id) {
    return request({
        url: prePath + `/deliverOrder/${id}`,
        method: 'get',
    })
}
//发货单重新发货
export function addDeliverOrderAgain(data) {
    return request({
        url: prePath + '/deliverOrder//insertAgain',
        method: 'post',
        data
    })
}

// 销售退货单分页查询
export function getSaleReturnPage(params) {
  return request({
    url: prePath + '/saleReturn/page',
    method: 'get',
    params
  })
}

// 销售退货确认
export function saleReturnConfirm(data) {
  return request({
    url: prePath + '/saleReturn/confirm',
    method: 'post',
    data
  })
}

// 销售退货拒绝
export function saleReturnReject(data) {
  return request({
    url: prePath + '/saleReturn/reject',
    method: 'post',
    data
  })
}

// 销售退货确认收货
export function saleReturnReceive(data) {
  return request({
    url: prePath + '/saleReturn/receive',
    method: 'post',
    data
  })
}

// 销售退货拒绝收货
export function saleReturnRefuse(data) {
  return request({
    url: prePath + '/saleReturn/refuse',
    method: 'post',
    data
  })
}

// 销售退货单详情
export function getSaleReturnDetail(id) {
  return request({
    url: prePath + '/saleReturn/' + id,
    method: 'get'
  })
}

// 销售退货订单产品
export function getSaleReturnRefuseDetailAll(params) {
  return request({
    url: prePath + '/saleReturnDetail/all',
    method: 'get',
    params
  })
}
//修改入库单明细
export function getDeliverOrderDetailCanSelectDetail(params) {
    return request({
        url : prePath + '/deliverOrderDetail/canSelectDetail',
        method : 'get',
        params
    })
}
//销售单
export function getPendSaleOrderPage(params) {
    return request({
        url : prePath + '/pendSaleOrder/page',
        method : 'get',
        params
    })
}
//销售单拒绝
export function pendSaleOrderRefuse(data) {
    return request({
        url : prePath + '/pendSaleOrder/refuse',
        method : 'post',
        data
    })
}
//销售单明细
export function getSaleDetailByPurch(data) {
    return request({
        url : prePath + '/pendSaleOrder/getSaleDetailByPurch',
        method : 'post',
        data
    })
}
//发货单根据销售单导入
export function getDeliverDetailBySaleId(id) {
    return request({
        url : prePath + '/deliverOrder/getDeliverDetailBySaleId/'+id,
        method : 'get'
    })
}
//发货单添加产品
export function pagePendDeliverProducts(params) {
    return request({
        url : prePath + '/deliverOrderDetail/pagePendDeliverProducts',
        method : 'get',
        params
    })
}
//发货单作废
export function deliverOrderDetailInvalid(data) {
    return request({
        url : prePath + '/deliverOrder/invalid',
        method : 'post',
        data
    })
}
//发货单个体详情
export function deliverOrderDetailAll(params) {
    return request({
        url : prePath + '/deliverOrderDetail/all',
        method : 'get',
        params
    })
}
//发货单合并详情
export function mergeDeliverOrderDetail(params) {
  return request({
    url : prePath + '/deliverOrderDetail/mergeList',
    method : 'get',
    params
  })
}

//发货单扫码
export function deliverOrderScan(data) {
    return request({
        url : prePath + '/deliverOrder/scan',
        method : 'post',
        data
    })
}

//获取生成收货单的发货单列表
export function getPendReceivingDeliverOrderList(params) {
  return request({
    url : prePath + '/deliverOrder/getPendReceivingDeliverOrderList',
    method : 'get',
    params
  })
}

//发货校验
export function deliverOrderValidateLicense(data) {
    return request({
      url : prePath + '/deliverOrder/validateLicense',
      method : 'post',
      data
    })
  }

//发货-分页查询
export function getDeliverOrderCustomizeListPage(data) {
  return request({
    url : prePath + '/deliverOrder/customizeList/page',
    method : 'post',
    data
  })
}
//发货-分页查询
export function getDeliverOrderDetailCustomizeListPage(data) {
  return request({
    url : prePath + '/deliverOrderDetail/customizeList/page',
    method : 'post',
    data
  })
}
//发货-询
export function getDeliverOrderDetailCustomizeListAll(data) {
  return request({
    url : prePath + '/deliverOrderDetail/customizeList/all',
    method : 'post',
    data
  })
}
//发货-分组查询
export function getDeliverOrderDetailCustomizeGroups(data) {
  return request({
    url : prePath + '/deliverOrderDetail/customizeGroups',
    method : 'post',
    data
  })
}
//发货-导出excel
export function excelDetailDeliverOrder(data) {
  return request({
    url : prePath + '/deliverOrder/excelDetail',
    method : 'post',
    data,
    responseType: 'blob'
  })
}
//发货-导出excel
export function excelListDeliverOrder(data) {
  return request({
    url : prePath + '/deliverOrder/excelList',
    method : 'post',
    data,
    responseType: 'blob'
  })
}
//发货-打印
export function printDetailDeliverOrder(data) {
  return request({
    url : prePath + '/deliverOrder/printDetail',
    method : 'post',
    data,
  })
}
//发货-打印
export function printListDeliverOrder(data) {
  return request({
    url : prePath + '/deliverOrder/printList',
    method : 'post',
    data,
  })
}
//发货-打印
export function printDeliverOrderDetail(data) {
  return request({
    url : prePath + '/deliverOrderDetail/print',
    method : 'post',
    data
  })
}
//发货-导出excel
export function excelDeliverOrderDetail(data) {
  return request({
    url : prePath + '/deliverOrderDetail/excel',
    method : 'post',
    data,
    responseType: 'blob'
  })
}


//待处理发货单-分页查询
export function getPendDealDeliverOrderCustomizeListPage(data) {
  return request({
    url : prePath + '/pendDealDeliverOrder/customizeList/page',
    method : 'post',
    data
  })
}


//待处理发货单-导出excel
export function pendDealDeliverOrderExcelListDeliverOrder(data) {
  return request({
    url : prePath + '/pendDealDeliverOrder/excelList',
    method : 'post',
    data,
    responseType: 'blob'
  })
}
//待处理发货单-打印
export function pendDealDeliverOrderPrintDetailDeliverOrder(data) {
  return request({
    url : prePath + '/pendDealDeliverOrder/printList',
    method : 'post',
    data,
  })
}
//重新发货
export function deliverOrderReshipment(data) {
  return request({
    url : prePath + '/deliverOrder/reshipment',
    method : 'post',
    data,
  })
}
